//
//  UIView+NED.h
//  MoreCoin
//
//  Created by 林宁宁 on 2019/9/23.
//  Copyright © 2019 MoreCoin. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (NED)


/** 顶部圆角*/
- (void)cornerTop:(float)corner;
/** 左部圆角*/
- (void)cornerLeft:(float)corner;
/** 底部圆角*/
- (void)cornerBottom:(float)corner;
/** 右部圆角*/
- (void)cornerRight:(float)corner;
/** 四个圆角 */
- (void)cornerAll:(float)corner;
/// 圆
- (void)cornerAllGarden;

/// 描边
- (void)cornerAll:(float)corner withWidth:(CGFloat)width withColor:(UIColor *)color;
///圆描边宽度为1
- (void)cornerAllGardenColor:(UIColor *)color;


- (void)corner:(float)corner pos:(UIRectCorner)corners;
/** 无圆角*/
- (void)cornerNone;

/** uiview转成图片*/
- (UIImage *)ned_drawToImage;

/**
 *  通过 CAShapeLayer 方式绘制虚线
 *
 *  param lineLength:     虚线的宽度
 *  param lineSpacing:    虚线的间距
 *  param lineColor:      虚线的颜色
 *  param lineDirection   虚线的方向  YES 为水平方向， NO 为垂直方向
 */
- (void)ned_drawDottedLineWithLineLength:(double)lineLength lineSpacing:(int)lineSpacing lineColor:(UIColor *)lineColor lineDirection:(BOOL)isHorizonal;

/// 虚线变宽
- (void)ned_dashBorder:(UIColor *)lineColor;

/// 添加单个线条
- (void)ned_drawLineWithLineLength:(UIRectEdge)rectEdg;
- (void)ned_drawLineWithLineLength:(UIRectEdge)rectEdg lineLength:(double)lineLength lineColor:(UIColor *)lineColor;


/** 判断View是否显示在屏幕上*/
- (BOOL)ned_isDisplayedInScreen;

- (UIViewController *)ned_vc;

- (CGFloat)getViewBottom;

/// 添加点击手势
-(void)addTapClick:(void (^)(void))click;


@end


@interface UIView(NEDShadow)

@property (retain, nonatomic) CALayer * _Nullable ned_shadowLayer;
/** 添加阴影*/
- (void)ned_addShadow:(void (^ _Nullable)(CALayer * _Nullable shadowLayer))shadowConfig;
- (void)ned_renderShadow:(void (^_Nullable)(CALayer * _Nullable shadowLayer))shadowConfig;
- (void)ned_renderShadow;
- (void)ned_cleanShadow;

@end

/// 渐变色
@interface UIView(NEDColor)
- (void)ned_gradientColors:(NSArray <UIColor *> *)colors locations:(NSArray<NSNumber *> * _Nullable)locations;
- (UIColor *)ned_colorAtPoint:(CGPoint)point;
@end


NS_ASSUME_NONNULL_END
